﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace EQual.MainModule.Documents.DetailViews
{
    /// <summary>
    /// Interaction logic for RoleDestributionView.xaml
    /// </summary>
    public partial class RoleDestributionView : UserControl
    {

        public RoleDestributionPresenter presenter;

        public RoleDestributionView()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {

            presenter.DisplayRolesDialog();
        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            presenter.DisplayEmployeesDialog();
        }

        internal void DisplayRoles(DataAccesLayer.Document ActiveItem)
        {
            this.comboBox1.Items.Clear();
            foreach (DataAccesLayer.Role role in new DataAccesLayer.EQualDataLayerFactory().GetEmployeeAccesLayer().GetRolesDestribution(presenter.ActiveItem))
                this.comboBox1.Items.Add(role.Name);

            comboBox1.Items.Add(new Separator()); //separator

            foreach (DataAccesLayer.Employee  empl in new DataAccesLayer.EQualDataLayerFactory().GetEmployeeAccesLayer().GetEmploeesDocumentNotification (presenter.ActiveItem.Id.ToString () ))
                this.comboBox1.Items.Add(empl .ToString ());

        }
    }
}
